package com.job.DQH.dqh718.homework;

import java.util.Random;

public class LotteryNum {

    public static boolean isInNums(int[] nums,int num){
        for (int i = 0; i <nums.length ; i++) {
            if(nums[i] == num){
                return true;
            }
        }
        return false;
    }

    public static int[] createNum(){
        Random ran = new Random();
        int num;
        int[] nums = new int[7];
        int i = 0;

        while(i<7) {
            num = ran.nextInt(33)+1;
            if(!isInNums(nums,num)){
                nums[i] = num;
            }else {
                continue;
            }
            i++;
        }

        return nums;
    }

    public static int prizeLevel(int[] winNums,int[] buyerNums){
        int count = 0;
        for (int i = 0; i <winNums.length ; i++) {
            for (int j = 0; j <winNums.length ; j++) {
                if(buyerNums[j] == winNums[i]){
                    count++;
                }
            }
        }
        return count;
    }
}
